import time

def consumer(name):
    print('%s准备吃包子啦'% name)
    while True:
        baozi = yield
        print('包子[%s]来了，被[%s]吃了'%(baozi, name))

def producer(name):
    c = consumer('A')
    c2 = consumer('B')
    c.__next__()
    c2.__next__()
    print('开始做包子啦')
    for i in range(10):
        time.sleep(1)
        print('做了一个包子')
        c.send(i)   #send方法，传入yield并调用
        c2.send(i)

producer('刘奇')